java.lang.Object
ddejonge.bandana.tournamentObserver.TournamentData
- All Implemented Interfaces:
java.io.Serializable
public class TournamentData
extends java.lang.Object
implements java.io.Serializable
- See Also:
- Serialized Form
-
Constructor Summary
Constructors Constructor Description TournamentData(int numParticipants, java.util.List<Team> teams, java.util.List<ScoreCalculator> scoreCalculators)
-
Method Summary
Modifier and Type Method Description void
addResult(GameResult newResult)
Adds the results of a new game.java.util.List<GameResult>
getGameResults()
java.util.List<java.lang.String>
getPlayerNames()
Returns the names of all the players that have so far participated in the tournament.java.util.List<ScoreCalculator>
getScoreCalculators()
java.lang.String
getScoreString(Team team)
java.lang.String
getScoreString(java.lang.String teamName)
Team
getTeamByName(java.lang.String teamName)
Returns the Team with the given teamName.java.util.List<Team>
getTeams()
java.util.List<Team>
getTeamsSorted()
Returns the list of teams, sorted according to the scoreCalculators of this TournamentData object (the team with the best score will be first in the list).java.util.List<Team>
getTeamsSorted(java.util.List<ScoreCalculator> scoreCalculators)
Returns the list of teams, sorted according to the given scoreCalculators (the team with the best score will be first in the list).java.lang.String
toString()
-
Constructor Details
-
TournamentData
public TournamentData(int numParticipants, java.util.List<Team> teams, java.util.List<ScoreCalculator> scoreCalculators)- Parameters:
numParticipants
- The total number of participants in the tournament.teams
- The list of teams for which we want to keep the scores. If null each player will be considered a team by itself.scoreCalculators
-
-
-
Method Details
-
addResult
Adds the results of a new game. This will also automatically cause the ScoreCalculators to be updated with this result.- Parameters:
newResult
-
-
getPlayerNames
public java.util.List<java.lang.String> getPlayerNames()Returns the names of all the players that have so far participated in the tournament.- Returns:
-
toString
public java.lang.String toString()- Overrides:
toString
in classjava.lang.Object
-
getScoreString
public java.lang.String getScoreString(java.lang.String teamName) -
getScoreString
-
getTeamsSorted
Returns the list of teams, sorted according to the scoreCalculators of this TournamentData object (the team with the best score will be first in the list).- Returns:
-
getTeamsSorted
Returns the list of teams, sorted according to the given scoreCalculators (the team with the best score will be first in the list).- Parameters:
scoreCalculators
-- Returns:
-
getScoreCalculators
-
getGameResults
-
getTeams
-
getTeamByName
Returns the Team with the given teamName.
Returns null if no such team is stored in this TournamentResult object.- Parameters:
teamName
-- Returns:
-